package com.foreknow.demo141;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author shkstart
 * @create 2021-08-03 15:13
 */
public class Test {
    public static void main(String[] args) {
        DBUtil dbUtil=new DBUtil();
        try {
            //1.获取数据库连接
            dbUtil.getConnection();
            //2.调用查询方法
            ResultSet rs = dbUtil.Query("select * from guestbook where id=?", "1");
            if(rs.next()){
                System.out.println(rs.getInt("id")+"--"+rs.getString("name"));
            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
